<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/3/7
 * Time: 14:38
 */

namespace app\controllers;


use app\models\Country;
use app\models\User;
use yii\web\Controller;
use app\models\Article;

class CountryController extends Controller
{
    public function actionIndex()
    {
        $model = new Country();
        $datas = $model->getAll();
        return $this->render('index', ['countries' => $datas['countries'], 'pagination' => $datas['pagination']]);
    }


    public function actionUser()
    {
        $data = User::find()->with('articles')->one();
        var_dump($data->id);
        //var_dump($data->articles);
        foreach ($data->articles as $value) {
            var_dump($value->title);
        }
    }
}